<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ConfigSiteOption.aspx.cs" Inherits="Webadmin_ConfigSiteOption" %>
<%@ Register Src="../PowerBy.ascx" TagName="PowerBy" TagPrefix="uc1" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">       
    <link href="../../CSS/bzAdmin.css" rel="stylesheet" type="text/css" />   
    <title>.: Welcome to Admin Console :.</title>
   <style type="text/css">
   <!--
    .groupSite{        
        margin-left:7px;
        cursor:pointer;
        border:1px solid #bcbcbc;
        border-bottom:none;
        float:left;
        padding:20px;
        padding-top:5px;
        padding-bottom:5px;
     }
     .groupSiteActive{
        margin-left:7px;
        cursor:pointer;
        border:1px solid #bcbcbc;
        border-bottom:none;
        float:left;
        padding:20px;
        padding-top:5px;
        padding-bottom:5px;
        background:#F00000;
        color:#FFFFFF;
     }
   -->
   </style>
</head>
<body>
    <form id="frmMain" method="post" action="?Act=Update" onsubmit="return(confirm('<%=_AdminLang["ConfigList_QuestionUpdate"].ToString() %>'));">
    <div align="center">
    <table width="90%" border="0" cellpadding="0" cellspacing="0" class="box_main">  
  <tr>
    <td width="100%" height="30" valign="top" class="navigator" align="left">&nbsp;<asp:Label ID="lblNavigator" runat="server"></asp:Label></td>
  </tr>
  <tr>
    <td valign="top" align="center">
    <div id="BothGroup">
    <%foreach(DataRow dr in _dt.Rows){ %>
    <div class="groupSite" id="<%=dr["GroupOption"] %>ida" onclick="showDiv('<%=dr["GroupOption"] %>id')"><%=_AdminLang[dr["GroupOption"].ToString()] %></div>
    <%} %>
    <div class="groupSiteActive" id="groupshowall" onclick="showDivAll(this.id)"><%=_AdminLang["SiteOption_ShowAllGroup"] %></div>
    </div>
<div style="clear:both;"></div>
<div id="BothAll">
<%foreach (DataRow drGroup in _dt.Rows){
      _dtSiteOption = this.loadSiteOption(drGroup["GroupOption"].ToString());
%>
<div id="<%=drGroup["GroupOption"] %>id" style="">

		<table class="box_into" width="98%" border="0" cellpadding="5" cellspacing="0">		  
		  <tr>
		  	<td colspan="2" height="12" class="input_textbox">&nbsp;</td>
		</tr>	
		 <%foreach (DataRow dr in _dtSiteOption.Rows)
     {
         string[] strArrVal = dr["ValueOption"].ToString().Split(';');
         string[] strArrName = dr["ValueName"+Session["Lang"].ToString()].ToString().Split(';');
         string strCheck = "";
         %>
		  <tr>
			<td width="40%" height="22" valign="top" align="right" class="input_label" style="font-weight:normal"><%=dr["Name"+Session["Lang"].ToString()] %>&nbsp;</td>
			<td width="60%" height="22" valign="top" align="left" class="input_textbox">
			<%switch (dr["Type"].ToString().Trim()) { 
         case "Text":
        %>
        <input type="text" name="<%=dr["Name"].ToString() %>" value="<%=dr["ValueSelect"].ToString() %>" style="width:240px;"/>
        <%
            break;
          case "Description":
        %>
        <div style="height:auto;" class="showAlways"><%=dr["ValueSelect"].ToString() %></div>
        <%
            break;
         case "Radio":   
             for (int i = 0; i < strArrVal.Length;i++ )
             {
                 if (dr["ValueSelect"].ToString().Trim() == strArrVal[i].Trim()) strCheck = "checked"; else strCheck = "";
                          
             %>
             <input type="radio" name="<%=dr["Name"].ToString() %>" value="<%=strArrVal[i] %>" <%=strCheck %> />&nbsp;<%=strArrName[i]%>&nbsp;
             <%}
               break;  
         case "Line":
             %>
             <div style="height:5px;"></div>
             <%
             break;
         case "Select":             
             %>
             <select name="<%=dr["Name"].ToString() %>">
             <%for (int i = 0; i < strArrVal.Length; i++)
               {
                   if (dr["ValueSelect"].ToString().Trim() == strArrVal[i].Trim()) strCheck = "selected"; else strCheck = "";
                   %>
               <option value="<%=strArrVal[i] %>" <%=strCheck %>><%=strArrName[i] %></option>
               <%} %>
             </select>
             <% 
                 break;
         case "TextArea":
             %> <textarea cols="30" rows="6" name="<%=dr["Name"].ToString() %>" style="width:280px;height:70px;"><%=dr["ValueSelect"].ToString() %></textarea>
             <%
             break;
         case "CheckBox":             
             for (int i = 0; i < strArrVal.Length;i++ )
             {
                 strCheck = "";
                 string[] strArrSelect = dr["ValueSelect"].ToString().Split(',');
                 foreach(string str in strArrSelect)
                     if (str.Trim() == strArrVal[i].Trim())
                     {
                         strCheck = "checked";
                         break;
                     }                     
             %>
                <input type="checkbox" name="<%=dr["Name"].ToString() %>" value="<%=strArrVal[i] %>" <%=strCheck %>/>&nbsp;<%=strArrName[i]%><br />
                <%}
               break;
     } %>
			</td>
		  </tr> 
		  
		  <%} %>
		  		  <tr>
		  	<td colspan="2" height="10">&nbsp;</td>
		</tr>			 
		</table>
		</div>
		<%} %>
		
		</div>
    </td>
  </tr>
  <tr>
			<td  height="22" valign="top" colspan="2" align="center"><input class="btn_submit" name="ok" type="submit" value="<%=_AdminLang["ConfigSiteOption_Update"].ToString() %>" /></td>			
  </tr>
  <tr>
  	<td height="10">&nbsp;<td>
  </tr>
</table><div style="clear:both"></div>

</div>    
</form>
<uc1:PowerBy ID="PowerBy1" runat="server" />
<script language="javascript" type="text/javascript">
function showDiv(oID)
{

    oDiv=document.getElementById('BothAll');
    oArrDiv=oDiv.getElementsByTagName('DIV');
    for(i=0;i<oArrDiv.length;i++)
        if(oArrDiv[i].className!='showAlways')  oArrDiv[i].style.display='none';       
    document.getElementById(oID).style.display='';
    
    oDiv=document.getElementById('BothGroup');
    oArrDiv=oDiv.getElementsByTagName('DIV');
    for(i=0;i<oArrDiv.length;i++)
           oArrDiv[i].className='groupSite';       
    document.getElementById(oID+'a').className='groupSiteActive';
}
function showDivAll(oID)
{
    oDiv=document.getElementById('BothAll');
    oArrDiv=oDiv.getElementsByTagName('DIV');
    for(i=0;i<oArrDiv.length;i++)
           oArrDiv[i].style.display='';    
    oDiv=document.getElementById('BothGroup');
    oArrDiv=oDiv.getElementsByTagName('DIV');
    for(i=0;i<oArrDiv.length;i++)
           oArrDiv[i].className='groupSite';       
    document.getElementById(oID).className='groupSiteActive';
}
</script>
</body>
</html>
